﻿#pragma execution_character_set("utf-8")
#include "Animal.h"

Animal::Animal()
{
    m_name = "无名";
}

Animal::Animal(QString name)
{
    m_name = name;
}

int Animal::getShoutNum() const
{
    return m_shoutNum;
}

void Animal::setShoutNum(int newShoutNum)
{
    if (newShoutNum <= 10) {
        m_shoutNum = newShoutNum;
    }
    else {
        m_shoutNum = 10;
    }
}

QString Animal::Shout()
{
    QString result = "";
    for (int i = 0; i < m_shoutNum; i++) {
        result += getShoutSound() + " ";
    }
    return QString("我的名字叫%1 %2").arg(m_name).arg(result);
}

Animal::~Animal()
{

}
